package com.wqb.service;

import java.io.Serializable;
import java.util.List;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.wqb.dao.IBaseDao;


@Service
@Transactional
public class BaseServiceImpl<T, PK extends Serializable> implements IBaseService<T, PK> {

	protected IBaseDao<T, PK> iBaseDao;


    /**
	 * @return the iBaseDao
	 */
	public IBaseDao<T, PK> getiBaseDao() {
		return iBaseDao;
	}

	/**
	 * @param iBaseDao the iBaseDao to set
	 */
	public void setiBaseDao(IBaseDao<T, PK> iBaseDao) {
		this.iBaseDao = iBaseDao;
	}

	public T get(PK id) {
		return iBaseDao.get(id);
	}

	public T load(PK id) {
		return iBaseDao.load(id);
	}
	
	public List<T> get(PK[] ids) {
		return iBaseDao.get(ids);
	}
	
	public T get(String propertyName, Object value) {
		return iBaseDao.get(propertyName, value);
	}
	
	public List<T> getList(String propertyName, Object value) {
		return iBaseDao.getList(propertyName, value);
	}

	public List<T> getAll() {
		return iBaseDao.getAll();
	}
	
	public Long getTotalCount() {
		return iBaseDao.getTotalCount();
	}

	public boolean isUnique(String propertyName, Object oldValue, Object newValue) {
		return iBaseDao.isUnique(propertyName, oldValue, newValue);
	}
	
	public boolean isExist(String propertyName, Object value) {
		return iBaseDao.isExist(propertyName, value);
	}

	public PK save(T entity) {
		return iBaseDao.save(entity);
	}

	public void update(T entity) {
		iBaseDao.update(entity);
	}

	public void delete(T entity) {
		iBaseDao.delete(entity);
	}

	public void delete(PK id) {
		iBaseDao.delete(id);
	}

	public void delete(PK[] ids) {
		iBaseDao.delete(ids);
	}
	
	public void flush() {
		iBaseDao.flush();
	}

	public void clear() {
		iBaseDao.clear();
	}
	
	public void evict(Object object) {
		iBaseDao.evict(object);
	}

	


}
